package com.fu.web.serviceImplments;

import com.fu.web.entity.chargestaff;
import com.fu.web.entity.doctor;
import com.fu.web.entity.pharmacy;
import com.fu.web.mapper.chargestaffMapper;
import com.fu.web.mapper.doctorMapper;
import com.fu.web.mapper.pharmacyMapper;
import com.fu.web.service.loginService;
import org.apache.ibatis.annotations.Select;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class loginServiceImpl implements loginService {
    @Autowired
    private chargestaffMapper chargestaffMapper;
    @Autowired
    private doctorMapper doctorMapper;
    @Autowired
    private pharmacyMapper pharmacyMapper;

    @Override
    public doctor checkDoc(String username, String pwd) {
        doctor doctor = doctorMapper.selectByPrimaryKey(username);
        if(doctor!=null){
            return doctor;
        }
        return null;
    }

    @Override
    public chargestaff checkStaff(String username, String pwd) {
        chargestaff chargestaff = chargestaffMapper.selectByPrimaryKey(username);
        if (chargestaff!=null){
            return chargestaff;
        }
        return null;
    }

    @Override
    public pharmacy checkPharmacy(String username, String pwd) {
        pharmacy pharmacy = pharmacyMapper.selectByPrimaryKey(username);
        if(pharmacy!=null){
            return pharmacy;
        }
        return null;
    }
}
